﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WindowsFormsApp1
{
    public partial class Form4 : Form
    {
        public Form4()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            var title = textBox1.Text.Trim();
            var author = textBox2.Text.Trim();
            var createtime = textBox3.Text.Trim();
            var insert = string.Format("insert into Articles(Title,Author,CreateTime) values('{0}','{1}','{2}')", title, author, createtime);
            if (title.Length>0||author.Length>0||createtime.Length>0)
            {
                DbHelp.dataSet(insert);
                Form4 form4 = new Form4();
                this.Close();
                Form2 form2 = new Form2();
                form2.Show();
            }
            else
            {
                MessageBox.Show("抱歉，不能为空");
            }
        }

        private void button2_Click(object sender, EventArgs e)
        {
            Form4 form4 = new Form4();
            this.Close();
            Form2 form2 = new Form2();
            form2.Show();
        }
    }
}
